package com.shinan.springboot1.web;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController

public class SessionController {
    @RequestMapping(value="/sessiontest")
    public String sessionTest(@RequestParam() String name, HttpSession session) {
        if (null != session.getAttribute(name)) {
            return name + "已经登陆了";
        } else {
            session.setAttribute(name, name);
            return name + "登陆成功";
        }
    }
}



